package com.courier.controller;
import com.courier.pojo.Chat;
import com.courier.service.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.websocket.Session;
import java.util.HashMap;

/**
 * @author mohan lau
 * @version 1.0
 * @ClassName: ChatController
 * @Description: TODO 聊天的控制器
 * @Date: 2021-05-12 15:29
 */
@Controller
public class ChatController {
    @Autowired
    ChatService chatService;
    private Session session;
    private String courierName;
/*用来保存所有的配送员的名称*/
    private static final HashMap<String,String> chatName=new HashMap<String,String>();
      // 进入聊天界面
      @RequestMapping("/tochat")
      public String tochat() {
          System.out.println("toregist*************");
          return "courierchat";
      }
     /*保存发出的信息*/
      @RequestMapping("/toinsertchat")
      @ResponseBody
      public String toinsertchat(Chat chat) {
       boolean a= chatService.insert(chat);
       if (a){
          return "成功";
       }else {
           return "失败";
       }
}
}
